﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="query.aspx.cs" Inherits="AnyOffice.general.email.query" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>查询邮件</title>
		
		<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
		<meta name="CODE_LANGUAGE" Content="C#">
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
		<LINK href="/module/date_selector/popcalendar.css" type="text/css" rel="stylesheet">
		<script src="/module/date_selector/popcalendar.js"></script>
		<script src="/aspnet_client/core/function.js"></script>
		<script>
function CheckForm()
{      
   if(!checkIsDate(document.Form1.txtBeginDate.value))
   {
	 alert("开始日期不正确！");
	 document.Form1.txtBeginDate.focus();
	 return (false);
   }
    if(!checkIsDate(document.Form1.txtEndDate.value))
   {
	 alert("结束日期不正确！");
	 document.Form1.txtEndDate.focus();
	 return (false);
   }
      
   if(document.Form1.sltReadFlag.value=="" && document.Form1.txtBeginDate.value=="" && document.Form1.txtEndDate.value=="" && document.Form1.txtUserName =="" && document.Form1.txtSubject.value=="" && document.Form1.txtKey1.value=="" && document.Form1.txtKey2.value=="" && document.Form1.txtKey3.value=="" && document.Form1.txtAttachmentName.value=="")
   { alert("请指定至少一个查询条件！");
     return (false);
   }

   return true;
}

function which_box()
{
   if(document.Form1.sltType.value != "outbox")   	  
		document.getElementById("UserNameText").innerText = "发件人";   	   
   else
		document.getElementById("UserNameText").innerText = "收件人";
}
		</script>
	</HEAD>
	<body class="bodycolor" topmargin="5">
		<form id="Form1" method="post" runat="server">
			<table border="0" width="100%" cellspacing="0" cellpadding="3" class="small">
				<tr>
					<td class="Big"><img src="/images/menu/infofind.gif" WIDTH="18" HEIGHT="18" align="absMiddle"><span class="big3">
							<asp:Literal id="litNavTitle" runat="server" Text="查询邮件"></asp:Literal></span><br>
					</td>
				</tr>
			</table>			
			<asp:Panel id="pnlMain" runat="server">
				<TABLE class="small" cellSpacing="1" cellPadding="3" width="450" align="center" border="0" bgcolor="#000000">
					<TR class="TableData">
						<TD noWrap align="center">选择邮箱：</TD>
						<TD noWrap>
							<SELECT class="BigSelect" id="sltType" onchange="which_box();" name="sltType" runat="server">								
						</SELECT>
						</TD>
					</TR>
					<TR class="TableData">
						<TD noWrap align="center">邮件状态：</TD>
						<TD noWrap>
							<SELECT class="BigSelect" id="sltReadFlag" name="sltReadFlag" runat="server">	
								<option value="">所有</option>
								<option value="false">未读</option>
								<option value="true">已读</option>						
							</SELECT>
						</TD>
					</TR>
					<TR class="TableData">
						<TD noWrap align="center">日期：</TD>
						<TD noWrap><INPUT class="BigInput" id="txtBeginDate" type="text" maxLength="10" size="10" name="txtBeginDate"
								runat="server"> <IMG style="CURSOR: hand" onclick="popUpCalendar(this,txtBeginDate,'yyyy-mm-dd','');"
								src="/module/date_selector/calendar.gif" align="absMiddle" border="0">&nbsp;至
							<INPUT class="BigInput" id="txtEndDate" type="text" maxLength="10" size="10" name="txtEndDate"
								runat="server"><IMG style="CURSOR: hand" onclick="popUpCalendar(this,txtEndDate,'yyyy-mm-dd','');" src="/module/date_selector/calendar.gif"
								align="absMiddle" border="0">&nbsp;
						</TD>
					</TR>
					<TR class="TableData" id="FROM">
						<TD noWrap align="center"><SPAN id="UserNameText">发件人</SPAN></TD>
						<TD noWrap><INPUT class="BigInput" id="txtUserName" type="text" maxLength="100" size="20" name="txtUserName"
								runat="server"></TD>
					</TR>
					<TR class="TableData">
						<TD noWrap align="center">邮件主题包含文字：</TD>
						<TD noWrap><INPUT class="BigInput" id="txtSubject" type="text" maxLength="100" size="20" name="txtSubject"
								runat="server"></TD>
					</TR>
					<TR>
						<TD class="TableData" noWrap align="center">邮件内容[关键词1]：</TD>
						<TD class="TableData"><INPUT class="BigInput" id="txtKey1" type="text" maxLength="100" size="20" name="txtKey1"
								runat="server"></TD>
					</TR>
					<TR>
						<TD class="TableData" noWrap align="center">邮件内容[关键词2]：</TD>
						<TD class="TableData"><INPUT class="BigInput" id="txtKey2" type="text" maxLength="100" size="20" name="txtKey2"
								runat="server"></TD>
					</TR>
					<TR>
						<TD class="TableData" noWrap align="center">邮件内容[关键词3]：</TD>
						<TD class="TableData"><INPUT class="BigInput" id="txtKey3" type="text" maxLength="100" size="20" name="txtKey3"
								runat="server"></TD>
					</TR>
					<TR class="TableData">
						<TD noWrap align="center">附件文件名包含文字：</TD>
						<TD noWrap><INPUT class="BigInput" id="txtAttachmentName" type="text" maxLength="100" size="20" name="txtAttachmentName"
								runat="server"></TD>
					</TR>
					<TR>
						<TD class="TableControl" noWrap align="center" colSpan="2">
						<INPUT class="BigButton" title="查询" onclick="return CheckForm();" type="submit" value="查询">						
						</TD>
					</TR>
				</TABLE>
			</asp:Panel>
			<asp:Panel id="pnlLater" runat="server" Visible="False">
					<asp:Repeater id="rptInbox" runat="server">
				<HeaderTemplate>
					<table border="0" cellspacing="1" width="95%" class="small" bgcolor="#000000" cellpadding="3">
						<tr class="TableHeader">
							<td nowrap align="center">状态</td>
							<td nowrap align="center">发件人</td>
							<td nowrap align="center" width="40%">主题</td>
							<td nowrap align="center">日期</td>
							<td nowrap align="center">大小</td>
						</tr>
				</HeaderTemplate>
				<ItemTemplate>
					<tr class="TableLine1">
						<td noWrap align="center">
							<%#(Convert.ToBoolean(Eval("ReadFlag")) == true) ? "<img title='已读' src='/images/email_open.gif' border='0'>" : ""%>
							<%#(Convert.ToBoolean(Eval("ReadFlag")) == false) ? "<img title='未读' src='/images/email_new.gif' border='0'>" : ""%>
						</td>
						<td noWrap align="center"><u title="部门：<%#Eval("DeptName")%>" style="cursor:hand"><%#Eval("UserName")%></u></td>
						<td>
						    <a href="inbox_read_email.aspx?email_id=<%#Eval("EmailId")%>&position=query&page=1"><%#Eval("Subject").ToString() == "" ? "[无主题]" : Eval("Subject").ToString()%>
						    <%#(Convert.ToInt32(Eval("TotalSize")) == 1) ? "<span class=\"TextColor1\">重要</span>" : ""%>
							<%#(Convert.ToInt32(Eval("TotalSize")) == 2) ? "<span class=\"TextColor1\">非常重要</span>" : ""%>
						    </a>
						</td>
						<td noWrap><%#Eval("SendTime")%></td>
						<td noWrap align="center"><%#formatSize(Convert.ToInt64(Eval("TotalSize")))%></td>
					</tr>
				</ItemTemplate>
				<AlternatingItemTemplate>
					<tr class="TableLine2">
						<td noWrap align="center">
							<%#(Convert.ToBoolean(Eval("ReadFlag")) == true) ? "<img title='已读' src='/images/email_open.gif' border='0'>" : ""%>
							<%#(Convert.ToBoolean(Eval("ReadFlag")) == false) ? "<img title='未读' src='/images/email_new.gif' border='0'>" : ""%>
						</td>
						<td noWrap align="center"><u title="部门：<%#Eval("DeptName")%>" style="cursor:hand"><%#Eval("UserName")%></u></td>
						<td>
						     <a href="inbox_read_email.aspx?email_id=<%#Eval("EmailId")%>&position=query&page=1"><%#Eval("Subject").ToString() == "" ? "[无主题]" : Eval("Subject").ToString()%>
						    <%#(Convert.ToInt32(Eval("TotalSize")) == 1) ? "<span class=\"TextColor1\">重要</span>" : ""%>
							<%#(Convert.ToInt32(Eval("TotalSize")) == 2) ? "<span class=\"TextColor1\">非常重要</span>" : ""%>
						    </a>
						</td>
						<td noWrap><%#Eval("SendTime")%></td>
						<td noWrap align="center"><%#formatSize(Convert.ToInt64(Eval("TotalSize")))%></td>
					</tr>
				</AlternatingItemTemplate>
				<FooterTemplate>
					</table>
				</FooterTemplate>
			</asp:Repeater>
			<asp:Repeater id="rptOutbox" runat="server">
			<HeaderTemplate>
			<br>
					<table border="0" cellspacing="1" width="95%" class="small" bgcolor="#000000" cellpadding="3">
						<tr class="TableHeader">
							<td nowrap align="center">状态</td>
							<td nowrap align="center">收件人</td>
							<td nowrap align="center">主题</td>
							<td nowrap align="center">重要程度</td>
							<td nowrap align="center">日期</td>
							<td nowrap align="center">字节</td>
						</tr>
				</HeaderTemplate>
				<ItemTemplate>
					<tr class="TableLine1">
						<td noWrap align="center"><%#formatStatus(Convert.ToInt32(Eval("DeleteFlag")),Convert.ToBoolean(Eval("ReadFlag")))%></td>
						<td noWrap align="center"><u title="部门：<%#Eval("DeptName")%>" style="cursor:hand"><%#Eval("UserName")%></u></td>
						<td><a href="outbox_read_email.aspx?email_id=<%#Eval("EmailId")%>&position=query&page=1"><%#Eval("Subject").ToString() == "" ? "[无主题]" : Eval("Subject").ToString()%></a></td>
						<td noWrap align="center"><%#(Convert.ToInt32(Eval("TotalSize")) == 1) ? "<span class=\"TextColor1\">重要</span>" : ""%>
						<%#(Convert.ToInt32(Eval("TotalSize")) == 2) ? "<span class=\"TextColor1\">非常重要</span>" : ""%></td>
						<td noWrap><%#Eval("SendTime")%></td>
						<td noWrap align="center"><%#formatSize(Convert.ToInt64(Eval("TotalSize")))%></td>
					</tr>
				</ItemTemplate>
				<AlternatingItemTemplate>
				<tr class="TableLine2">
						<td noWrap align="center"><%#formatStatus(Convert.ToInt32(Eval("DeleteFlag")),Convert.ToBoolean(Eval("ReadFlag")))%></td>
						<td noWrap align="center"><u title="部门：<%#Eval("DeptName")%>" style="cursor:hand"><%#Eval("UserName")%></u></td>
						<td><a href="outbox_read_email.aspx?email_id=<%#Eval("EmailId")%>&position=query&page=1"><%#Eval("Subject").ToString() == "" ? "[无主题]" : Eval("Subject").ToString()%></a></td>
						<td noWrap align="center">		<%#(Convert.ToInt32(Eval("TotalSize")) == 1) ? "<span class=\"TextColor1\">重要</span>" : ""%>
						<%#(Convert.ToInt32(Eval("TotalSize")) == 2) ? "<span class=\"TextColor1\">非常重要</span>" : ""%></td>
						<td noWrap><%#Eval("SendTime")%></td>
						<td noWrap align="center"><%#formatSize(Convert.ToInt64(Eval("TotalSize")))%></td>
					</tr>
				</AlternatingItemTemplate>
				<FooterTemplate>
					</table>
				</FooterTemplate>
				</asp:Repeater>
				<br>
<div align="center">
 <input type="button"  value="返回" class="BigButton" onClick="location='query.aspx'">
</div>
				</asp:Panel>
			<asp:Literal id="litMessage" runat="server"></asp:Literal>
		</form>
	</body>
</HTML>
